package com.caoji.controller;


import com.caoji.entity.User;
import com.caoji.service.IUserService;
import com.netflix.client.http.HttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author caoji
 * @since 2020-11-26
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    IUserService service;

    @Value("server.port")
    String port;
    @GetMapping("/list/{id}")
    public User findall(@PathVariable("id") String name, HttpServletRequest request){
        System.out.println("这是"+port);
        System.out.println(request.getHeader("name"));
        return service.findone(name);
    }
}

